﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<Hotnet.Entity.VideoChild>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	<%=ViewData["Title"] %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
	<div style=" font-size:x-large"><%=ViewData["Title"] %></div>
	<div>
		<a style="float:right" href="/AdminVideoGroup/CreateGroupVideo/?groupID=<%=ViewData["GroupID"] %>"></a>
		<div style=" margin:15px 0px 3px 0px;">
			<span style="color:Red">
				所在位置:
			</span>
			<a href="/AdminVideo/Index/?categoryID=<%=ViewData["CategoryID"] %>" style=" text-decoration:none;">
				<%=ViewData["CategoryName"] %>
			</a>
			->
			<a href="/AdminVideoGroup/GroupVideoList/<%=ViewData["GroupID"] %>" style="text-decoration:none;">视频组:<%=ViewData["GroupName"] %></a>
			->
			<%=ViewData["Title"] %>
		</div>
	</div>
	<div style=" text-align:center;color:Red; font-size:large"><%=TempData["UpdateResult"]%></div>
	<% using (Html.BeginForm("CreateGroupVideo", "AdminVideoGroup",null, FormMethod.Post, new { enctype = "multipart/form-data",id="formCreateUpdate" }))
	{%>
	
	<input type="hidden" id="hiddenGroupID" name="GroupID" value="<%=ViewData["GroupID"] %>" />
	<table width="100%" class="ma list">
		<tr>
			<td align="right">
				<label for="Name">
					视频名称:</label>
			</td>
			<td>
				<%= Html.TextBox("Name")%>
			</td>
			
			<td align="right">
				<label for="VideoSrc">
					视频播放地址:</label>
			</td>
			<td>
				<%= Html.TextBox("VideoSrc")%>
				<a href="javascript:void(0)" onclick="preview()" >预览</a>
			</td>
		</tr>
		<tr>
			<td align="right">
				<label for="DownLoadUrl">
					视频下载地址:</label>
			</td>
			<td>
				<%= Html.TextBox("DownLoadUrl")%>
			</td>
			<td align="right">
				<label for="OrderInGroup">
					组中序号:</label>
			</td>
			<td>
				<%= Html.TextBox("OrderInGroup")%>
			</td>
		</tr>
		
		<tr>
			<td align="right">
				<label for="CoverImagePath">
					封面图片:</label>
			</td>
			<td >
				<input type="file" onchange="showPreviewImage();" id="CoverImage" name="coverImage" />
			</td>
			<td colspan="2">
				<img alt="封面图片" src='<%=Model==null?"#":Model.CoverImagePath %>' id="coverImg" style=" width:110px;height:90px;" />
			</td>
		</tr>
		<tr>
			<td colspan="4">
				<label for="Description">
					视频描述:</label>
			</td>
		</tr>
		<tr>
			<td colspan="4">
				<%= Html.TextArea("Description")%>
			</td>
		</tr>
		<tr>
			<td colspan="4" align="center">
				<input type="submit" value="确定" />
				<input type="button" value="返回" onclick="window.location.href='/AdminVideoGroup/GroupVideoList/<%=ViewData["GroupID"] %>'" />
			</td>
		</tr>
	</table>
	<% } %>
	
	
	<div id="flashPreview" style="display:none;">
		
	</div>
	
	<script type="text/javascript">
		var oFCKeditor = new FCKeditor('Description', "100%", "250");
		oFCKeditor.ReplaceTextarea();

		var groupId = '<%=Model==null?ViewData["GroupID"]:Model.GroupID %>';
		var videoId = '<%=Model==null?0:Model.VideoID %>';
		var flashBoxy;
		var flashCodePart1 = "<embed src='";
		var flashCodePart2="' id='flashEmbed'"
							+ "'quality='high' width='480' height='400' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash'>'"
							+ "</embed>";

		function preview() {
			var flashCode = flashCodePart1 + $("#VideoSrc").val() + flashCodePart2;
			$("#flashPreview").html(flashCode);
			if (flashBoxy == null)
				flashBoxy = new Boxy($('#flashPreview'), { modal: false, title: '视频预览', closeText: '[×]', draggable: true });
			else
				flashBoxy.show();
		}

		function showPreviewImage() {
			$('#coverImg').attr('src', $('#CoverImage').val())
			$('#coverImg').attr('style', "width:200px;height:150px;");
		}

		$(document).ready(
			function() {

				if (videoId != 0) {
					$("#formCreateUpdate").attr("action", "/AdminVideoGroup/EditGroupVideo/?videoID=" + videoId);
					$("#hiddenGroupID").attr("value", groupId);
				}
			}
		);
		
	</script>

</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="StyleContent" runat="server">
</asp:Content>

